angular.module('Controller')
.controller('QgySuggestionManageEditCtrl',($scope,urls,$localStorage,NgTableParams,commonUtil,cryptUtil,wfAlert,commonConstant,$http, $uibModalInstance, items)->
    $scope.type=type=items.type
    $scope.data=data=items.data
    $scope.modalTitle=if type=='view' then '投诉详情' else '投诉处理'
    $scope.modalEnableList=commonConstant.enabledList()
    $scope.repairStatusList=commonConstant.repairStatusList(true)

    editData=()->
        reqData={
            dealResult:$scope.data.dealResult,
            status:2
        }
        $http.put("/backend/complaint/#{$scope.data.id}",reqData)
        .success((resp)->
            if resp.code==0
                wfAlert.toastInfo($scope.modalTitle+'成功')
                $uibModalInstance.close('done')
            else
                wfAlert.toastError(resp.message)
        )
    $scope.confirm = ()->
        if type=='view'
            $uibModalInstance.dismiss('cancel')
        else
            editData()
    $scope.cancel =()->
        $uibModalInstance.dismiss('cancel')
)